package my.graduation.controller.admin;

import my.graduation.dto.ClinicInfoDto;
import my.graduation.result.Result;
import my.graduation.service.ClinicService;
import my.graduation.vo.ClinicVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: RavenLyn
 * @Date: 2024-12-10
 */
@RestController
@RequestMapping("/admin/clinic")
public class AdmClinicController {

    @Autowired
    private ClinicService clinicService;

    /**
     * 获取所有门诊信息
     * @return
     */
    @GetMapping
    public Result<List<ClinicVO>> list(){
        return clinicService.getList();
    }

    /**
     * 条件获取门诊信息
     * @param dto
     * @return
     */
    @PostMapping("/con")
    public Result<List<ClinicVO>> getListByCon(@RequestBody ClinicInfoDto dto){
        return clinicService.getListByCon(dto);
    }

    /**
     * 新增门诊信息
     * @return
     */
    @PostMapping
    public Result add(@RequestBody ClinicInfoDto dto){
        return clinicService.add(dto);
    }

    /**
     * 修改门诊信息
     * @return
     */
    @PutMapping
    public Result update(@RequestBody ClinicInfoDto dto){
        return clinicService.update(dto);
    }

    /**
     * 删除门诊信息
     * @return
     */
    @DeleteMapping
    public Result delete(@RequestBody ClinicInfoDto dto){
        return clinicService.delete(dto);
    }
}
